package com.hanoi.wiki.model;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

import com.hanoi.wiki.model.json.UserEvaluationJson;

@Entity
@Table(name="USER_EVALUATION")
public class UserEvaluation implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public UserEvaluation() {
		
	}
	
	public UserEvaluation(UserEvaluationJson json) {
		this.description 	= json.getDescription();
		this.status 		= json.getStatus();
		this.position		= json.getPosition();
		this.pointEarned 	= json.getPointEarned();
	}
	
	@Id
	@Column(name="ID")	
	private Integer id;
	
	@Column(name="POSITION", length = 2000)
	private String position;
	
	@Column(name="POINT_EARNED")
	private Integer pointEarned;
	
	@Column(name="DESCRITPION", length = 2000)
	private String description;
	
	@Column(name="STATUS")
	private Integer status;
	
	@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@PrimaryKeyJoinColumn
	private User user;
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getPosition() {
		return position;
	}
	public void setPosition(String position) {
		this.position = position;
	}
	public Integer getPointEarned() {
		return pointEarned;
	}
	public void setPointEarned(Integer pointEarned) {
		this.pointEarned = pointEarned;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}	
	public User getUser() {
		return user;
	}	
	public void setUser(User user) {
		this.user = user;
	}
}
